//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//

//
#ifndef Green_VmFactoryGPGPU_H
#define Green_VmFactoryGPGPU_H

#include "Enums.h"
#include "VmFactory.h"
#include ARCH_ENUM_HEADER

namespace Green {

  /*!
    \class VmFactoryGPGPU
    \brief Class for constructing RISC-specific virtual memory management objects.
  */
  class VmFactoryGPGPU : public VmFactory {
  public:
    explicit VmFactoryGPGPU(const EVmRegimeType vmRegimeType) : VmFactory(vmRegimeType) { } //!< Constructor
    ~VmFactoryGPGPU() override = default; //!< Destructor
    VmFactoryGPGPU& operator=(const VmFactoryGPGPU& rOther) = delete; //!< Copy assignment operator not currently needed.

    VmDirectMapControlBlock* CreateVmDirectMapControlBlock(const EMemBankType memBankType) const override; //!< Create an appropriate VmDirectMapControlBlock instance.
    VmasControlBlock* CreateVmasControlBlock(const EMemBankType memBankType) const override; //!< Create an appropriate VmasControlBlock instance.
    AddressTagging* CreateAddressTagging(const VmControlBlock& rVmControlBlock) const override; //!< Create an appropriate AddressTagging instance.
    VmRegime* VmRegimeInstance() const override; //!< Return an GPGPU VmRegime object based on the regime enum type.
    PteAttribute* PteAttributeInstance(EPteAttributeType attrType) const override; //!< Return an appropriate PteAttribute instance.
    void SetupVmConstraints(std::vector<ConstraintSet* >& rVmConstraints) const override; //!< Setup GPGPU VM Constraints.
    VmContext* CreateVmContext() const override; //!< Setup VmContext.
    void CreatePageTableConstraints(std::vector<PageTableConstraint* >& rPageTableConstraints) const override; //!< Setup Page Table constraints.
    VmPaMapper* VmPaMapperInstance(VmAddressSpace* pAddressSpace) const override; //!< Return an GPGPU VmPaMapper instance.
    EPrivilegeLevelType GetPrivilegeLevel() const override; //!< Return privilege level of Regime
    void GetRegisterContext(std::vector<std::string>& rRegNames, bool pagingEnabled) const override; //!< Update rRegNames with list of context register names
    void GetDelayedRegisterContext(std::vector<std::string>& rRegNames) const override; //!< Update rRegNames with list of delayed init context register names
    bool PagingEnabled(Generator& rGen) const override; //!< Return bool indicating whether or not paging is enabled
  protected:
    VmFactoryGPGPU(const VmFactoryGPGPU& rOther) = delete; //!< Copy constructor not currently needed.
    VmFactoryGPGPU() = default; //!< Default constructor.
  };

}

#endif  // Green_VmFactoryGPGPU_H
